package com.example.demo.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.dao.UserDao;
import com.example.demo.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * @author shenb
 * @date 2022-06-29 14:26
 */
@RestController
@RequestMapping("users")
public class UserController {

    @Autowired
    private UserDao userDao;

    @GetMapping()

    public List<User> list() {
        User user = new User();
        user.setStruct(new HashMap<>());
        user.getStruct().put("name", "1top");
        userDao.insert(user);
        List<User> all = userDao.selectList(new QueryWrapper<>());
        System.out.println(all);
        return all;
    }
}
